package nfwx.analytics;

import java.util.Date;

/**
 * 采集参数：视频会话事件基类
 */

public class GrabVideoEvent extends GrabObject {

    ///视频事件名
    //加载事件
    public static final String EVENT_NAME_LOAD="load";
    //Seek事件
    public static final String EVENT_NAME_SEEK="seek";
    //pause事件
    public static final String EVENT_NAME_PAUSE="pause";
    //resume事件
    public static final String EVENT_NAME_RESUME="resume";
    //缓冲事件
    public static final String EVENT_NAME_BUFFER="buffer";
    //播放错误事件
    public static final String EVENT_NAME_PLAY_ERR="playErr";
    //播放完成事件
    public static final String EVENT_NAME_END="end";

    //事件名
    public final GrabString type;
    //事件发生时间ms
    public final GrabNumber time;
    //事件发生时的播放时间戳
    public final GrabNumber playTime;
    //事件发生时的播放时间码
    public final GrabNumber tc;
    //事件的附加参数
    public final GrabObject extra;


    public GrabVideoEvent(String type)
    {
        super(false);
        this.type = (GrabString)defineProperty("type", new GrabString(true));
        this.type.setValue(type);
        time = (GrabNumber)defineProperty("time", new GrabNumber(true));
        playTime = (GrabNumber)defineProperty("playTime", new GrabNumber(false));
        tc = (GrabNumber)defineProperty("tc", new GrabNumber(false));
        extra = (GrabObject) defineProperty("extra", new GrabObject(false));

        time.setValue((new Date()).getTime());
    }
}
